using System.ComponentModel.Design;
using System.Windows.Forms;
using Microsoft.Practices.WizardFramework;

namespace Sixeyed.Guidance.CodeGeneration.CustomWizardPages
{
    /// <summary>
    /// Base class for custom wizard pages
    /// </summary>
    public partial class CustomWizardPageBase : CustomWizardPage
    {
        private IDictionaryService _dictionaryService;
        private IDictionaryService DictionaryService
        {
            get
            {
                if (this._dictionaryService == null)
                {
                    this._dictionaryService = GetService(typeof(IDictionaryService)) as IDictionaryService;
                }
                return this._dictionaryService;
            }
        }

        /// <summary>
        /// Deault constructor
        /// </summary>
        public CustomWizardPageBase() { }

        /// <summary>
        /// Constructor with initial state
        /// </summary>
        /// <param name="parent">Parent Wizard form</param>
        public CustomWizardPageBase(WizardForm parent) : base(parent) {}

        /// <summary>
        /// Sets the value of the named arument
        /// </summary>
        /// <typeparam name="T">Argument type</typeparam>
        /// <param name="argumentName">Argument name</param>
        /// <param name="value">New argument value</param>
        protected void SetArgumentValue<T>(string argumentName, T value)
        {
            this.DictionaryService.SetValue(argumentName, value);
        }

        /// <summary>
        /// Gets the value of the named argument
        /// </summary>
        /// <typeparam name="T">Argument type</typeparam>
        /// <param name="argumentName">Argument name</param>
        /// <returns>Argument value</returns>
        protected T GetArgumentValue<T>(string argumentName)
            where T : class
        {
            return this.DictionaryService.GetValue(argumentName) as T;
        }

        private void InitializeComponent()
        {
            ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
            this.SuspendLayout();
            // 
            // infoPanel
            // 
            this.infoPanel.Location = new System.Drawing.Point(0, 0);
            this.infoPanel.Size = new System.Drawing.Size(600, 275);
            // 
            // CustomWizardPageBase
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.InfoRTBoxSize = new System.Drawing.Size(0, 0);
            this.Name = "CustomWizardPageBase";
            this.Size = new System.Drawing.Size(600, 275);
            ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }
    }
}